﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

/// <summary>
///GetHander 的摘要说明
/// </summary>
namespace MySpace.Data
{
    public class GetHandler
    {
        /// <summary>
        /// 静态方法，初始化DBhander对象（有参数重载）
        /// </summary>
        /// <param name="connectionStrinName">web.config对应的连接字符串</param>
        /// <returns></returns>
        public static DBHandler Init(string connectionStrinName)
        {
            ConnectionStringSettings css = ConfigurationManager.ConnectionStrings[connectionStrinName];
            string strcon = css.ConnectionString;
            return new DBHandler(strcon);
            
        }

        /// <summary>
        /// 静态方法，初始化DBhander对象没有参数重载
        /// </summary>
        /// <returns></returns>
        public static DBHandler Init()
        {

            string strcon = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            return new DBHandler(strcon);
        }
    }
}